<template>
	<view class="pb">
		<view v-if="info.banner"><cover-image style="width: 100%;height: auto;" :src="info.banner"></cover-image></view>
		<view class="content p15">
			<view v-html="info.content"></view>
			<view class="text-center mt30" v-if="info.image_code">
				<view>报名咨询</view>
				<image style="width: 380rpx;" show-menu-by-longpress="true" :src="info.image_code" mode="widthFix"></image>
			</view>
			<view class="text-center">
				<view @click="onTell" v-if="info.concat" >TEL：{{info.concat}}</view>
			</view>
		</view>
		<view class="fixed-bottom">
			<view class="p0-8"><button class="default-button-push" @click="customer()">咨询</button></view>
		</view>
		
		<uni-popup ref="popupCustomer" background-color="none">
			<customerVue></customerVue>
		</uni-popup>
	</view>
</template>

<script>
	import customerVue from '../../components/customer.vue'
	export default {
		components: {
			customerVue
		},
		data() {
			return {
				id:0,
				info:{}
			}
		},
		onLoad(options){
			this.id = options.id
			this.onGetInfo()
		},
		methods: {
			onGetInfo(){
				let _this = this
				this.$request_api('applet_api/activity_info/'+_this.id,'GET').then(res => {
					res.data.content = res.data.content.replace(/\<img/gi, '<img style="width:100%;height:auto"');
					_this.info = res.data
				}).catch(err => {
					console.log(err)
				})
			},
			onTell(){
				let _this = this
				 uni.makePhoneCall({
					phoneNumber: _this.info.concat, // 电话号码
					success: function () {
						console.log('Call Success');
					},
					fail: function () {
						console.log('Call Failed');
					}
				});
			},
			customer(){
				this.$refs.popupCustomer.open('center')
			}
		}
	}
</script>

<style>

</style>
